package com.hspedu.abstract_;

/**
 * @author 谷其昊
 * @version 1.0
 * @date 2022/1/27
 * @time 18:40
 */
public class AbstractExercise01 {
    public static void main(String[] args) {
        //这里还是一个向上转型
       Employee e1 = new Manager("gqh",1,10000,2000);
       e1.work();
        new CommonEmployee("azy",250,100).work();
    }
}

 abstract class Employee{
    private String name;
    private int id;
    private double salary;

    public Employee(String name, int id, double salary) {
        this.name = name;
        this.id = id;
        this.salary = salary;
    }

     /**
      * 工作的具体实现
      */
    public abstract void work();

     public String getName() {
         return name;
     }

     public int getId() {
         return id;
     }

     public double getSalary() {
         return salary;
     }
 }

class Manager extends Employee{

    private double bonus;

    public Manager(String name, int id, double salary, double bonus) {
        super(name, id, salary);
        this.bonus = bonus;
    }

    @Override
    public void work() {
        System.out.println("经理 "+getName()+"工作中");
    }
}

class CommonEmployee extends Employee{
    public CommonEmployee(String name, int id, double salary) {
        super(name, id, salary);
    }

    @Override
    public void work() {
        System.out.println("普通员工 "+getName()+"工作中");
    }
}